import React from "react";
import {Popconfirm} from "antd";
import "./HConfirm.less"

import {QuestionCircleOutlined} from "@ant-design/icons";

export type HConfirmProps = {
    ok?: () => void;
    cancel?: () => void;
    children: React.ReactNode;
    title: string;
}

export default class HConfirm extends React.Component<HConfirmProps, any> {


    render() {
        const {ok, cancel, children, title} = this.props
        return <>
            <Popconfirm
                title={title}
                icon={<QuestionCircleOutlined style={{color: 'red'}}/>}
                onConfirm={ok}
                onCancel={cancel}
            >
                {children}
            </Popconfirm>
        </>;
    }
}
